<%@ page import="cn.edu.njust.pojo.User" %>
<%@ page import="cn.edu.njust.pojo.Register" %>
<%@ page import="cn.edu.njust.service.UserService" %>
<%@ page import="cn.edu.njust.service.impl.UserServiceImpl" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>CCF预报名系统|预报名信息</title>

  <!-- Google Font: Source Sans Pro -->
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="./plugins/fontawesome-free/css/all.min.css">
  <!-- DataTables -->
  <link rel="stylesheet" href="./plugins/datatables-bs4/css/dataTables.bootstrap4.min.css">
  <link rel="stylesheet" href="./plugins/datatables-responsive/css/responsive.bootstrap4.min.css">
  <link rel="stylesheet" href="./plugins/datatables-buttons/css/buttons.bootstrap4.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="./dist/css/adminlte.min.css">

  <script src="./js/axios-0.18.0.js"></script>

</head>
<body class="hold-transition sidebar-mini">
<div class="wrapper">
  <nav class="main-header navbar navbar-expand navbar-white navbar-light">
    <!-- Left navbar links -->
    <ul class="navbar-nav">
      <li class="nav-item">
        <a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
      </li>
    </ul>

    <!-- Right navbar links -->
    <ul class="navbar-nav ml-auto">
      <li class="nav-item">
        <button type="button" class="btn btn-info" onclick="exitRegister()">退出当前登录</button>
      </li>
      <li class="nav-item">
        <a class="nav-link" data-widget="fullscreen" href="#" role="button">
          <i class="fas fa-expand-arrows-alt"></i>
        </a>
      </li>
    </ul>
  </nav>
  <!-- /.navbar -->

  <!-- Main Sidebar Container -->
  <aside class="main-sidebar sidebar-dark-primary elevation-4">
    <!-- Brand Logo -->
    <a href="#" class="brand-link">
      <img src="./dist/img/AdminLTELogo.png" alt="CCF预报名系统" class="brand-image img-circle elevation-3" style="opacity: .8">
      <span class="brand-text font-weight-light">CCF预报名系统</span>
    </a>

    <!-- Sidebar -->
    <div class="sidebar">
      <!-- Sidebar Menu -->
      <nav class="mt-2">
        <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">
          <!-- Add icons to the links using the .nav-icon class
               with font-awesome or any other icon font library -->
          <li class="nav-item">
            <a href="preRegister.jsp" class="nav-link">
              <i class="nav-icon fas fa-eraser"></i>
              <p>预报名</p>
            </a>
          </li>
          <li class="nav-item">
            <a href="myInfo.jsp" class="nav-link">
              <i class="nav-icon fas fa-exclamation"></i>
              <p>我的信息</p>
            </a>
          </li>
        </ul>
      </nav>
      <!-- /.sidebar-menu -->
    </div>
    <!-- /.sidebar -->
  </aside>
  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Main content -->
    <section class="content">
      <div class="container-fluid">
        <div class="row">
          <div class="col-12">
            <div class="card">
              <div class="card-body">
                <div style="text-align: center;background-color: #1C86EE;height: 100px">
                  <div style="color: white;text-align: center;font-size:25px;line-height: 100px">预报名信息</div>
                </div>
                <div class="card-footer">
                  <form>
                    <div class="form-group">
                      <label for="uid">学号</label>
                      <input type="text" id="uid" class="form-control" placeholder=${registerUser.idNo} disabled/>
                    </div>
                    <div class="form-group">
                      <label for="utype">自费/免费</label>
                      <%
                      HttpSession session2 = request.getSession();
                      Register reg =  (Register) session2.getAttribute("registerUser");
                        String ss;
                      if(reg.getIsUse()){
                            ss = "免费";
                      }else{
                            ss = "自费";
                      }

                       %>
                      <input type="text" id="utype" class="form-control" placeholder=<%=ss%> disabled/>
                    </div>
                    <div class="form-group">
                      <label for="ulanguage">编程语言</label>
                      <input type="text" id="ulanguage" class="form-control" placeholder=${registerUser.language} disabled/>
                    </div>
                    <div class="form-group">
                      <label for="ulanguage">审核情况</label>
                      <%
                        String fuck;
                        UserService us1 = new UserServiceImpl();
                        User u2 = us1.selectId01(reg.getIdNo());
                        if(0 == u2.getFlag()){
                          fuck = "待审批";
                        }else if(1 == u2.getFlag()){
                          fuck = "审批通过";
                        }else{
                          fuck = "审批未通过";
                        }%>
                      <input type="text" id="ucheck" class="form-control" placeholder=<%=fuck%>disabled/>
                    </div>
                  </form>
                </div>
              </div>
              <!-- /.card-body -->
            </div>
            <!-- /.card -->
          </div>
          <!-- /.col -->
        </div>
        <!-- /.row -->
      </div>
      <!-- /.container-fluid -->
    </section>
    <!-- /.content -->
    <section class="content">
      <div class="container-fluid">
        <div class="row">
          <div class="col-12">
            <div class="card">
              <div class="card-body">
                <!-- #号位置填写撤销预报名的servlet，若尚未报名，给出提示信息；若撤销成功，提示撤销成功 -->
                <form action="removeServlet" method="POST">
                  <div class="col-3">
                    <button type="submit" class="btn btn-primary btn-block">撤销预报名</button>
                  </div>
                </form>
              </div>
              <!-- /.card-body -->
            </div>
            <!-- /.card -->
          </div>
          <!-- /.col -->
        </div>
        <!-- /.row -->
      </div>
      <!-- /.container-fluid -->
    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->
  <footer class="main-footer">
    <div class="float-right d-none d-sm-block">
      <b>Version</b> 1.0.0
    </div>
    <div class="container">
      <div class="row">
        <div class="col-md-offset-1">
          <strong>Copyright &copy; 2022 <a href="#">软件项目管理第六小组</a>.</strong> All rights reserved.
        </div>
      </div>
    </div>
  </footer>

  <!-- Control Sidebar -->
  <aside class="control-sidebar control-sidebar-dark">
    <!-- Control sidebar content goes here -->
  </aside>
  <!-- /.control-sidebar -->
</div>
<!-- jQuery -->
<script src="./plugins/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="./plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- DataTables  & Plugins -->
<script src="./plugins/datatables/jquery.dataTables.min.js"></script>
<script src="./plugins/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
<script src="./plugins/datatables-responsive/js/dataTables.responsive.min.js"></script>
<script src="./plugins/datatables-responsive/js/responsive.bootstrap4.min.js"></script>
<script src="./plugins/datatables-buttons/js/dataTables.buttons.min.js"></script>
<script src="./plugins/datatables-buttons/js/buttons.bootstrap4.min.js"></script>
<script src="./plugins/jszip/jszip.min.js"></script>
<script src="./plugins/pdfmake/pdfmake.min.js"></script>
<script src="./plugins/pdfmake/vfs_fonts.js"></script>
<script src="./plugins/datatables-buttons/js/buttons.html5.min.js"></script>
<script src="./plugins/datatables-buttons/js/buttons.print.min.js"></script>
<script src="./plugins/datatables-buttons/js/buttons.colVis.min.js"></script>
<!-- AdminLTE App -->
<script src="./dist/js/adminlte.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="./dist/js/demo.js"></script>
<script>
  function exitRegister(){
    axios({
      method:"post",
      url:"/CCF_Pre_Registration_System/systemControl/exitCurrentLoginUser"
    }).then(function (resp){
      if(resp.data==="success"){
        window.location.href="index.jsp";
      }else {
        alert("请重试");
      }
    })
  }
</script>
</body>
</html>